package gui.secondary;

import java.awt.Color;
import java.net.URL;

import javax.swing.JLabel;

import tool.CustomizedButton;

import controller.gui.mapstratamenu.MapStrataAddAfterCurrentController;
import controller.gui.mapstratamenu.MapStrataAddCeilingController;
import controller.gui.mapstratamenu.MapStrataAddFloorController;
import controller.gui.mapstratamenu.MapStrataCancelButtonController;
import controller.gui.mapstratamenu.MapStrataDeleteCurrentController;

import gui.DescribedCustomizedButton;
import gui.SecondaryMenu;
import gui.TextPanel;

/** Il SecondaryMenu che contiene le opzioni relative agli
 *  Strata, come ad esempio la loro creazione e distruzione.
 * @author Daniele
 * @version 1.3 */
public class StrataSecondaryMenu extends SecondaryMenu{

	private static final long serialVersionUID = -1751599489752729403L;
	
	// Scritte sui JLabels e sui DescribedCustomizedButtons.
	private static final String ADD_LABEL = "Insert a new Stratum:";
	private static final String ADD_STRATUM_BEGINNING = "Below Lowest Stratum";
	private static final String ADD_STRATUM_AFTER_CURRENT = "Above Current Stratum";
	private static final String ADD_STRATUM_AT_END = "Above Highest Stratum";
	private static final String REMOVE_LABEL = "Remove permanently:";
	private static final String REMOVE_CURRENT_STRATUM = "Current Stratum";
	
	// Descrizioni dei DescribedCustomizedButtons.
	private static final URL DESC_ADD_STRATUM_BEGINNING = StrataSecondaryMenu.class.getResource("addStratumBeginningDESC.html");
	private static final URL DESC_ADD_STRATUM_AFTER_CURRENT = StrataSecondaryMenu.class.getResource("addStratumAfterCurrentDESC.html");
	private static final URL DESC_ADD_STRATUM_AT_END = StrataSecondaryMenu.class.getResource("addStratumAtEndDESC.html");
	private static final URL DESC_REMOVE_CURRENT_STRATUM = StrataSecondaryMenu.class.getResource("removeStratumDESC.html");
	
	/** L'etichetta che indica la creazione di uno Stratum. */
	private JLabel addLabel;
	/** Il pulsante che crea uno Stratum al livello più basso. */
	private DescribedCustomizedButton addStratumAtBeginning;
	/** Il pulsante che aggiunge uno Stratum al di sopra di quello in evidenza. */
	private DescribedCustomizedButton addStratumAfterCurrent;
	/** Il pulsante che crea uno Stratum al livello più alto. */
	private DescribedCustomizedButton addStratumAtEnd;
	/** L'etichetta che indica la distruzione di uno Stratum. */
	private JLabel removeLabel;
	/** Il pulsante che distrugge lo Stratum in evidenza e tutti i suoi contenuti. */
	private DescribedCustomizedButton removeCurrentStratum;
	
	/** Costruisce il SecondaryMenu contenente le opzioni
	 *  riguardanti gli Strata. */
	public StrataSecondaryMenu(){
		super();
		
		descriptionLabel = new TextPanel();
		descriptionLabel.loadContent(StrataSecondaryMenu.class.getResource("StrataDESC.html"));
		this.initializeJScrollPane();
		this.addComponentToLayout(descriptionLabelScrollPane, 0, 0, 2.5, 10, 0, 2);
		
		addLabel = new JLabel(StrataSecondaryMenu.ADD_LABEL);
		this.addComponentToLayout(this.addLabel, 0, 1, 0.5, 0, 0, 2);
		
		this.addStratumAtBeginning = new DescribedCustomizedButton(StrataSecondaryMenu.ADD_STRATUM_BEGINNING,20,Color.WHITE,Color.BLUE,Color.WHITE,Color.BLUE,new Color(50,0,200),Color.GREEN,3,"Britannic Bold",Color.BLUE,Color.WHITE,Color.GREEN,StrataSecondaryMenu.DESC_ADD_STRATUM_BEGINNING);
		this.addComponentToLayout(this.addStratumAtBeginning, 0, 2, 0.5, 5, 10, 2);
		this.addStratumAtBeginning.addMouseListener(descriptionLabel);
		
		this.addStratumAfterCurrent = new DescribedCustomizedButton(StrataSecondaryMenu.ADD_STRATUM_AFTER_CURRENT,20,Color.WHITE,Color.BLUE,Color.WHITE,Color.BLUE,new Color(50,0,200),Color.GREEN,3,"Britannic Bold",Color.BLUE,Color.WHITE,Color.GREEN,StrataSecondaryMenu.DESC_ADD_STRATUM_AFTER_CURRENT);
		this.addComponentToLayout(this.addStratumAfterCurrent, 0, 3, 0.5, 10, 10, 2);
		this.addStratumAfterCurrent.addMouseListener(descriptionLabel);
		
		this.addStratumAtEnd = new DescribedCustomizedButton(StrataSecondaryMenu.ADD_STRATUM_AT_END,20,Color.WHITE,Color.BLUE,Color.WHITE,Color.BLUE,new Color(50,0,200),Color.GREEN,3,"Britannic Bold",Color.BLUE,Color.WHITE,Color.GREEN,StrataSecondaryMenu.DESC_ADD_STRATUM_AT_END);
		this.addComponentToLayout(this.addStratumAtEnd, 0, 4, 0.5, 10, 20, 2);
		this.addStratumAtEnd.addMouseListener(descriptionLabel);
		
		this.removeLabel = new JLabel(StrataSecondaryMenu.REMOVE_LABEL);
		this.addComponentToLayout(this.removeLabel, 0, 5, 0.5, 10, 0, 2);
		
		this.removeCurrentStratum = new DescribedCustomizedButton(StrataSecondaryMenu.REMOVE_CURRENT_STRATUM,20,Color.WHITE,Color.BLUE,Color.WHITE,Color.BLUE,new Color(50,0,200),Color.GREEN,3,"Britannic Bold",Color.BLUE,Color.WHITE,Color.GREEN,StrataSecondaryMenu.DESC_REMOVE_CURRENT_STRATUM);
		this.addComponentToLayout(this.removeCurrentStratum, 0, 6, 0.5, 5, 20, 2);
		this.removeCurrentStratum.addMouseListener(descriptionLabel);
		
		this.cancelButton = new DescribedCustomizedButton(SecondaryMenu.TXT_CANCEL,20,Color.WHITE,Color.BLUE,Color.WHITE,Color.BLUE,new Color(50,0,200),Color.GREEN,3,"Britannic Bold",Color.BLUE,Color.WHITE,Color.GREEN,SecondaryMenu.DESC_CANCEL);
		this.addComponentToLayout(cancelButton, 1, 7, 0.5, 10, 10, 1);
		this.cancelButton.addMouseListener(descriptionLabel);
	}
	
//	public void addListeners(MapStrataCancelButtonController cancel,MapStrataAddAfterCurrentController addcurrent,MapStrataAddFloorController addfloor,MapStrataAddCeilingController addceiling,MapStrataDeleteCurrentController delete){
//		addcurrent.wire(addStratumAfterCurrent, this);
//		addcurrent.wire(addStratumAfterCurrent,this);
//		addfloor.wire(addStratumAtBeginning,this);
//		addceiling.wire(addStratumAtEnd,this);
//		delete.wire(removeCurrentStratum,this);
//		cancel.wire(this.cancelButton,this);
//	}

	/** Getter per il pulsante addStratumAtBeginning.
	 * @return the addStratumAtBeginning */
	public CustomizedButton getAddStratumAtBeginning() {
		return addStratumAtBeginning;
	}

	/** Getter per il pulsante addStratumAfterCurrent.
	 * @return the addStratumAfterCurrent */
	public CustomizedButton getAddStratumAfterCurrent() {
		return addStratumAfterCurrent;
	}

	/** Getter per il pulsante addStratumAtEnd.
	 * @return the addStratumAtEnd */
	public CustomizedButton getAddStratumAtEnd() {
		return addStratumAtEnd;
	}

	/** Getter per il pulsante removeCurrentStratum.
	 * @return the removeCurrentStratum */
	public CustomizedButton getRemoveCurrentStratum() {
		return removeCurrentStratum;
	}
}
